Skip to content

Normalize forum subject/body HTML storage and migrate legacy encoded content#1872

Draft
Copilot wants to merge 3 commits intodevfrom
copilot/update-html-encoding-logic
Draft

Normalize forum subject/body HTML storage and migrate legacy encoded content#1872
Copilot wants to merge 3 commits intodevfrom
copilot/update-html-encoding-logic

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Subject/body encoding has drifted over time, resulting in mixed raw/encoded values in activeforums_Content and inconsistent rendering/email behavior. This PR standardizes persistence to store unencoded content and aligns rendering/token paths to avoid double-decoding.

  • Storage normalization (single boundary)

    • Added Utilities.NormalizeHtmlForStorage(...) to decode HTML entities once before persistence.
    • Applied normalization in topic/reply save paths (SqlDataProvider.Topics_Save, SqlDataProvider.Reply_Save, and post submit flow in af_post.ascx.cs), including topic summary.
  • Rendering/token alignment

    • Removed redundant HtmlDecode(...) in key read/render/edit mappings where data should now already be normalized:
      • TopicView / TopicsView content hydration
      • Post edit/reply form prefill in af_post.ascx.cs
      • TokenReplacer.ReplaceBody(...) decode path
    • Preserves existing output encoding behavior at render boundaries while preventing decode loops.
  • Upgrade data conversion

    • Added sql/09.07.00-1607.SqlDataProvider to normalize existing activeforums_Content.Subject and Body values (including doubly encoded legacy patterns).
    • Registered the script in DnnCommunityForums.dnn.
    • Included in-script reference notes for latest relevant stored proc versions (activeforums_Topics_Save, activeforums_Reply_Save, activeforums_Topics_SaveToForum).
  • Utility coverage

    • Added focused tests for Utilities.NormalizeHtmlForStorage(...) in UtilitiesTests (single decode behavior, empty/null handling).
internal static string NormalizeHtmlForStorage(string text)
{
    return string.IsNullOrEmpty(text) ? string.Empty : WebUtility.HtmlDecode(text);
}

Copilot AI changed the title [WIP] Update HTML encoding logic for subject and body Normalize forum subject/body HTML storage and migrate legacy encoded content Apr 17, 2026
Copilot AI requested a review from johnhenley April 17, 2026 13:14
@johnhenley johnhenley added this to the 09.08.00 milestone Apr 21, 2026
@johnhenley johnhenley added technical debt Issue that doesn't directly affect usability but will improve technical debt posture database Changes to database schema labels Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database Changes to database schema technical debt Issue that doesn't directly affect usability but will improve technical debt posture

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TASK: Consistent encoding/decoding of HTML in subject and body

2 participants